Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Using session super procedures

In addition to associating super procedures with a specific object procedure, you can also add them to the entire OpenEdge session so that every procedure that executes in the session can take advantage of them. You do this by executing the ADD-SUPER-PROCEDURE method from the SESSION handle:

SESSION:ADD-SUPER-PROCEDURE( hSuper ). 

The search order the interpreter uses to locate internal procedures and functions now becomes this:

  1. The procedure file the routine is run in (that is, either the procedure that actually contains the RUN statement or function reference or, if you use the RUN IN syntax or the DYNAMIC-FUNCTION . . . IN syntax, the procedure handle following the IN keyword).
  2. Super procedures added to that procedure handle, starting with the last one added.
  3. Super procedures added to the SESSION handle, starting with the last one added.

In addition, in the case of a RUN statement, if an internal procedure of that name is not located anywhere, the final step of the search is for a compiled external procedure (.r file) of that name.

You should exercise caution when adding super procedures to the session, precisely because their contents become available to absolutely every procedure run in the session. Nevertheless, this technique can be effective in some cases, especially for extending the behavior of existing application procedures without having to edit them to put in ADD-SUPER-PROCEDURE statements. If the existing procedure was originally intended to run a compiled external procedure (.r file) and does not explicitly include the .p or .r extension on the filename reference in the RUN statement, then the external .r file can be replaced by a session super procedure that contains an internal procedure of the same name. This changes the behavior of the application without making any changes whatsoever to the existing application files (not even recompiling them).


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095